<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/10/18 0018
 * Time: 17:06
 */
namespace Home\Controller;
use Think\Controller;
class ShowListController extends Controller {
    public function index(){
        $this->display('show');
    }
    public function allGoods(){
        $all_goods=M('goods');
        $data=$all_goods->select();
        $this->ajaxReturn($data);
        //$count=$all_goods->count();
        //$list['count']=$count;
        //$this->ajaxReturn($list);
    }
    public function getCount(){

        $all_goods=M('goods');
        $count=$all_goods->count();

        $list['count']=$count;
        $this->ajaxReturn($list);


    }
    public function getGoodsList(){

        $page_num=$_POST['pageNum'];
        $current_page=$_POST['currentPage'];
        $all_goods=M('goods');
        //从数据库取出前端需要的数据
        $data=$all_goods->limit("$current_page,$page_num")->select();
        //返回给前端
        $this->ajaxReturn($data);



    }
    public function wereAm(){
        $goods=M("goods");
        $id=$_SERVER["QUERY_STRING"];


        $goods->where("$id")->delete();
        echo "<h1>商品删除成功</h1><br/><a href='/Jd/index.php/Home/ShowList/show#'>返回商品列表</a>";
    }
}